/*   Shotscreens
 *   Copyright (C) 2010, Vadim Zakondyrin (http://crystalnix.com)
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef SCREENSHOTSEDITOR_H
#define SCREENSHOTSEDITOR_H

#include <QByteArray>
#include <QMainWindow>
#include "ui_screenshotseditor.h"
#include <QScopedPointer>
#include <QCloseEvent>
class QPushButton;
class QGraphicsPainter;
class QGraphicsScene;
class QGraphicsView;

class Tray;

class ScreenShotsEditor : public QMainWindow
{
    Q_OBJECT
public:
    explicit ScreenShotsEditor(QPixmap pixmap, QWidget *parent = 0);
    ~ScreenShotsEditor();
signals:
    void uploadImage(QByteArray);

public slots:

private:
    Ui::screenshotseditor ui;
// Metods for upload menu
    void initializationUploadMenu();
    QAction * newUploadAction(const QString &text);

// Metods for paint menu
    void initializationPaintMenu();
    QAction * undoButton;
    QAction *RedoButton;
    //toolbar
    QAction *arrow_action;
    QAction *brush_action;
    QAction *line_action;
    QAction *rectangle_action;
    QAction *text_action;
    QAction *normal_action;
    void initializationPainter(const QPixmap &pixmap);
    QRect original_size;
    QGraphicsPixmapItem *pixmap_item;
    enum ToolbarButtons
    {
        ArrowAction,
        BrushAction,
        LineAction,
        RectangleAction,
        TextAction,
        NormalAction
    };
    void SetButtonOn(ToolbarButtons button);
    QByteArray arr;
    Tray *t;

    void closeEvent(QCloseEvent *);
    QRect pixmap_rect;
private slots:
    void undoAction();
    void RedoAction();
    void brushAction();
    void lineAction();
    void arrowAction();
    void textAction();
    void propertyAction();
    void normalAction();
    void StartSaving();
    void AddText();
    void SaveScr();


};

#endif // SCREENSHOTSEDITOR_H
